﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true"
    CodeBehind="Edit.aspx.cs" Inherits="OneMG.Phoenix.AdminSite.Views.AdminUser.Edit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    编辑用户
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeadScripts" runat="server">
  <script type="text/javascript" src="/Scripts/m-former.js"></script>    
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div class="pd10">
        <form id="form1" method="post">
        <input type="hidden" id="hdaction" name="hdaction" value="<%=(objAdminUser!=null)?"3":"1" %>" />
        <input type="hidden" id="hduserid" name="hdaction" value="<%=(objAdminUser!=null)?objAdminUser.UserID:0 %>" />
        <table class="tb-list mt10">
            <tr>
                <td class="aR" style="width: 150px">
                    登录名：
                </td>
                <td class="aL">
                    <input type="text" name="txtUserName" id="txtUserName" value="<%=(objAdminUser!=null)?objAdminUser.UserName:"" %>"
                        maxlength="200" class="inputStyle" />
                    <span id="spTxtUserName" style="display: none;"></span>
                </td>
            </tr>
            <tr>
                <td class="aR">
                    用戶密码：
                </td>
                <td class="aL">
                    <input type="text" name="txtPassword" id="txtPassword" value="<%=(objAdminUser!=null)?objAdminUser.Password:"" %>"
                        maxlength="200" class="inputStyle" />
                    <span id="spTxtPassword" style="display: none;"></span>
                </td>
            </tr>
            <tr>
                <td class="aR">
                    重复密码：
                </td>
                <td class="aL">
                    <input type="text" name="txtPassword2" id="txtPassword2" value="<%=(objAdminUser!=null)?objAdminUser.Password:"" %>"
                        maxlength="200" class="inputStyle" />
                    <span id="spTxtPassword2" style="display: none;"></span>
                </td>
            </tr>
            <tr>
                <td class="aR">
                    用戶邮箱：
                </td>
                <td class="aL">
                    <input type="text" name="txtEMail" id="txtEMail" value="<%=(objAdminUser!=null)?objAdminUser.EMail:"" %>"
                        maxlength="200" class="inputStyle" />
                    <span id="spTxtEMail" style="display: none;"></span>
                </td>
            </tr>
            <tr>
                <td class="aR">
                    联系电话：
                </td>
                <td class="aL">
                    <input type="text" name="txtTelephone" id="txtTelephone" value="<%=(objAdminUser!=null)?objAdminUser.Telephone:"" %>"
                        maxlength="200" class="inputStyle" />
                    <span id="spTxtTelephone" style="display: none;"></span>
                </td>
            </tr>
            <tr>
                <td class="aR">
                    真实姓名：
                </td>
                <td class="aL">
                    <input type="text" name="txtTrueName" id="txtTrueName" value="<%=(objAdminUser!=null)?objAdminUser.TrueName:"" %>"
                        maxlength="200" class="inputStyle" />
                    <span id="spTxtTrueName" style="display: none;"></span>
                </td>
            </tr>
            <tr>
                <td class="aR">
                    备注：
                </td>
                <td class="aL">
                    <input type="text" name="txtMemo" id="txtMemo" value="<%=(objAdminUser!=null)?objAdminUser.Memo:"" %>"
                        maxlength="200" class="inputStyle" />
                    <span id="spTxtMemo" style="display: none;"></span>
                </td>
            </tr>
        </table>
        <div class="aC">
            <input id="subbtn" type="button" value="保存" class="i-btn3"/>
            <input type="button" value="取消" onclick="cancel();" class="i-btn3"/>        </form>
    </div>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="Scripts" runat="server">
<script type="text/javascript">
    $("#form1").former({
        submit: 'subbtn',    //提交按钮id
        style: { right: 'icon-right', error: 'icon-error' },
        ajax: true,         //开启ajax提交
        url: "/Views/AdminUser/Save.ashx",    //提交url
        //验证规则
        validate: {
            txtUserName: {
                tipElem: 'spTxtUserName',
                rules: [
		                { rule: 'EMPTY', txt: '用户名称不能为空' },
		                { rule: 'LENGTH', min: 0, max: 50, txt: '长度不超过50' }
		            ]
            },
            txtPassword: {
                tipElem: 'spTxtPassword',
                rules: [
		                { rule: 'EMPTY', txt: '密码不能为空' },
		                { rule: 'LENGTH', min: 6, max: 16, txt: '长度不超过16' }
		            ]
            }
        },
        //ajax提交成功执行
        success: function(data) {
            if (data.status === "warning" || data.status === "error") {
                alert(data.msg);
                return false;
            }
            // 操作成功
            alert(data.msg);
            // 执行回调方法
            successHandle();
        },
        //ajax提交失败执行
        error: function(jqXHR, textStatus, errorThrown) {
            alert('发生了未知错误');
        }
    });

    function cancel() {
        window.top.oDG.cancel();
    };

    /**
    * 弹窗处理
    */
    //窗口回调处理
    function successHandle() {
        window.top.winObj.refresh();
        window.top.oDG.cancel();
    };
    </script>
</asp:Content>
